package cn.nebula.core.admin.service;

import java.util.Collection;

import cn.nebula.core.admin.dao.SuperuserDao;
import cn.nebula.core.admin.model.Superuser;
import cn.nebula.core.base.service.BaseServiceImpl;
import edu.isquen.util.CommUtil;


public class SuperuserServiceImpl extends BaseServiceImpl implements SuperuserService {

	private static final long serialVersionUID = -7523750654479217539L;
	
	private SuperuserDao superuserDao;

	public Superuser doSaveOrUpdate(Superuser superuser) throws Exception {
		return superuser;
	}

	public Collection<Superuser> doList() {
		// TODO Auto-generated method stub
		return null;
	}

	public Superuser doLogin(String loginname, String loginpwd) throws Exception {
		if (!CommUtil.validateString(loginname)
				|| !CommUtil.validateString(loginpwd)) {
			return null;
		}
		return superuserDao.login(loginname, CommUtil.encodeToMD5(loginpwd));
	}

	public SuperuserDao getSuperuserDao() {
		return superuserDao;
	}

	public void setSuperuserDao(SuperuserDao superuserDao) {
		this.superuserDao = superuserDao;
	}

}
